﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="Shop.ascx.cs" Inherits="Admin_Components_MasterData_Shop" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
<telerik:RadScriptManager ID="ScriptManager2" runat="server" EnableTheming="True"></telerik:RadScriptManager>

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<telerik:radformdecorator id="QsfFromDecorator" runat="server" decoratedcontrols="All"
            enableroundedcorners="false" />
        <telerik:RadTabStrip ID="TabStrip1" runat="server" EnableDragToReorder="true" Skin="Vista" MultiPageID="RadMultiPag1" SelectedIndex="1">
            <Tabs>
                <telerik:RadTab Text="TẠO MỚI" Selected="True">
                </telerik:RadTab>
                <telerik:RadTab Text="TÌM KIẾM"></telerik:RadTab>
            </Tabs>
        </telerik:RadTabStrip>
        <telerik:RadMultiPage ID="RadMultiPag1" runat="server" SelectedIndex="0">
            <!--Tab thông tin chung -->
            <telerik:RadPageView ID="RadPageView1" runat="server"  Style="overflow: hidden">
                 <fieldset class="form" id="fsGeneral">
                  <br />
                <div class="form-horizontal wrapper-center clearfix">
                <!--Block bên trái -->
                 <div class="form-group col-md-6">
                     <!--Dòng -->
                    <div class="form-group">
                        <label class="col-md-3 control-label">
                            Mã cửa hàng</label>
                        <div class="col-md-7">
                            <telerik:RadTextBox ID="txtShopCode" CssClass="col-imp-3 inputForm" Width="40px" runat="server" readOnly= "true" />
                        </div>
                    </div>
                  <!--End Dòng -->
                     <!--Dòng -->
                <div class="form-group">
                    <label class="col-md-3 control-label">Loại cửa hàng</label>
                    <div class="col-md-7">
                        <telerik:RadComboBox ID="cbType" runat="server" CssClass="col-imp-5" AllowCustomText="false" EmptyMessage="---Chọn---" filter="Contains" AutoPostBack="true" OnSelectedIndexChanged="cbType_SelectedIndexChanged" >
                                <Items>
                                    <telerik:RadComboBoxItem Text="Cửa hàng tổng" Value="W" />
                                    <telerik:RadComboBoxItem Text="Cửa hàng lẻ" Value="S" />
                                </Items>
                            </telerik:RadComboBox>
                        <asp:RequiredFieldValidator  ID="RequiredFieldValidator3" runat="server" ControlToValidate="cbType" ValidationGroup="g1"
                           ErrorMessage="Required(*)" InitialValue=""></asp:RequiredFieldValidator>
                     </div>
                </div>
                <!--End Dòng -->
                  <!--Dòng -->
                <div class="form-group">
                    <label class="col-md-3 control-label">Tên cửa hàng</label>
                    <div class="col-md-9">
                        <telerik:RadTextBox ID="txtShopName" CssClass="col-imp-10 inputForm" Width="40px" runat="server" />
                        <asp:RequiredFieldValidator  ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtShopName" ValidationGroup="g1"
                           ErrorMessage="Required(*)" InitialValue=""></asp:RequiredFieldValidator>
                     </div>
                </div>
                <!--End Dòng -->
                     <!--Dòng -->
                <div class="form-group">
                    <label class="col-md-3 control-label">Tỉnh/thành phố</label>
                    <div class="col-md-7">
                        <telerik:RadComboBox ID="cbProvinceMain" runat="server" CssClass="col-imp-5" AllowCustomText="false" EmptyMessage="---Chọn tỉnh/thành---" filter="Contains"  >
                            </telerik:RadComboBox>
                        <asp:RequiredFieldValidator  ID="RequiredFieldValidator6" runat="server" ControlToValidate="cbProvinceMain" ValidationGroup="g1"
                           ErrorMessage="Required(*)" InitialValue=""></asp:RequiredFieldValidator>
                     </div>
                </div>
                <!--End Dòng -->
                <!--Dòng -->
                <div class="form-group">
                    <label class="col-md-3 control-label">Địa chỉ</label>
                    <div class="col-md-9">
                        <telerik:RadTextBox ID="txtAddress" CssClass="col-imp-10 inputForm" Width="40px" runat="server"  />
                        <asp:RequiredFieldValidator  ID="RequiredFieldValidator2" runat="server" ControlToValidate="txtAddress" ValidationGroup="g1"
                           ErrorMessage="Required(*)" InitialValue=""></asp:RequiredFieldValidator>
                     </div>
                </div>
                <!--End Dòng -->
                <!--Dòng -->
                <div class="form-group">
                    <label class="col-md-3 control-label">Số điện thoại</label>
                    <div class="col-md-7">
                        <telerik:RadTextBox ID="txtPhoneNumber" CssClass="col-imp-8 inputForm" Width="40px" runat="server"  />
                     </div>
                </div>
                <!--End Dòng -->
                 </div>
                 <!--End Block bên trái -->
                 <!--Block bên phải -->
                <div class="form-group col-md-6">
                    <!--Dòng -->
                     <div class="form-group">
                        <label class="col-md-3 control-label">Người cập nhật</label>
                        <div class="col-md-8">
                           <telerik:RadTextBox ID="txtLastUpdatedBy" CssClass="col-imp-4 inputForm" Width="40px" runat="server" readOnly= "true" />
                         </div>
                    </div>
                    <!--End Dòng -->
                     <!--Dòng -->
                     <div class="form-group">
                        <label class="col-md-3 control-label">Ngày cập nhật</label>
                        <div class="col-md-8">
                           <telerik:RadTextBox ID="txtLastUpdatedDateTime" CssClass="col-imp-4 inputForm" Width="40px" runat="server" readOnly= "true" />
                         </div>
                    </div>
                    <!--End Dòng -->
                    
                         </div>
                 <!--End Block bên phải -->
            </div>
            </fieldset>
            <!--Action-->
            <div class="set-btns text-center">
                <asp:Button ID="btnSave" CssClass="btn btn-sm btn-primary" runat="server" Text="Lưu"   ValidationGroup="g1"  OnClick="btnSave_Click"/>
                <asp:Button ID="btnCancel" CssClass="btn btn-sm btn-warning" runat="server" Text="Xóa"  OnClientClick="return ConfirmOnDelete('Bạn chắc chắn muốn xóa?')"  OnClick="btnCancel_Click"/>
                <asp:Button ID="btnNew" CssClass="btn btn-sm btn-primary" runat="server" Text="Tạo mới"  OnClick="btnNew_Click" />
            </div>
            <!--End Action -->
                <div class="form-group text-left"><B>Danh sách địa điểm bán hàng theo cửa hàng:</B></div>
                <div class="form-group text-left">
                <telerik:RadComboBox ID="cbProvince" runat="server" CssClass="col-imp-3" EmptyMessage="Nhập Tỉnh/thành phố" AutoPostBack="true" OnSelectedIndexChanged="cbProvince_SelectedIndexChanged"  filter="Contains" ></telerik:RadComboBox>
                    <asp:RequiredFieldValidator  ID="RequiredFieldValidator4" runat="server" ControlToValidate="cbProvince" ValidationGroup="g2"
                           ErrorMessage="Required(*)" InitialValue=""></asp:RequiredFieldValidator>
                <telerik:RadComboBox ID="cbDistrict" runat="server" CssClass="col-imp-3" EmptyMessage="Nhập Huyện/quận" filter="Contains" ></telerik:RadComboBox>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" Display="Dynamic" ValidationGroup="g2"
                            ControlToValidate="cbDistrict" ErrorMessage="Required(*)"></asp:RequiredFieldValidator>
                
                <asp:Button ID="btnAdd" runat="server" CssClass="btn btn-sm btn-primary"  ValidationGroup="g2" Text="Thêm" OnClick="btnAdd_Click"/>
            </div>

                <!--Grid data-->
            <div class="row">
            <div style="float: left;font-weight:bold" runat="server" id="div_TotalProduct" >&nbsp;Tổng cộng: 0</div><BR/>
            <telerik:radgrid id="gvLocation" runat="server" cellspacing="0" cssclass=" table table-bordered"
                gridlines="None" autogeneratecolumns="False" Height="200" Width="850px"  headerstyle-horizontalalign="Center" OnItemCommand="gvLocation_ItemCommand" 
                allowmultirowselection="True" headerstyle-borderstyle="None">
                <ClientSettings>
                <Scrolling AllowScroll="True" UseStaticHeaders="True" SaveScrollPosition="true" FrozenColumnsCount="2"></Scrolling>
            </ClientSettings>
                <MasterTableView ShowHeader="true" NoMasterRecordsText="Không có dữ liệu." ShowGroupFooter="true">
                <Columns>
                    <telerik:GridTemplateColumn HeaderText="STT" HeaderButtonType="TextButton" ItemStyle-HorizontalAlign="Center">
                        <ItemTemplate>
                            <%# Container.ItemIndex + 1 %></ItemTemplate>
                        <HeaderStyle Width="50px" />
                        <ItemStyle HorizontalAlign="Center" />
                    </telerik:GridTemplateColumn>
                    <telerik:GridBoundColumn DataField="LocationID" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center"
                                 UniqueName="LocationID" Display="false">
                                <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
                                <ItemStyle HorizontalAlign="Center"></ItemStyle>
                    </telerik:GridBoundColumn>
                    
                    <telerik:GridTemplateColumn HeaderText="Tỉnh/thành phố" UniqueName="ProvinceName" DataField="ProvinceName">
                            <ItemTemplate>
                                <asp:Label ID="lblProvinceName" runat="server" Text='<%# Eval("ProvinceName")%>'></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle HorizontalAlign="Left" />
                        <ItemStyle HorizontalAlign="Left" Font-Bold ="true"/>
                    </telerik:GridTemplateColumn>

                     <telerik:GridTemplateColumn HeaderText="Huyện/quận" UniqueName="DistrictName" DataField="DistrictName">
                            <ItemTemplate>
                                <asp:Label ID="lblDistrictName" runat="server" Text='<%# Eval("DistrictName")%>'></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle HorizontalAlign="Left" />
                        <ItemStyle HorizontalAlign="Left" Font-Bold ="true"/>
                    </telerik:GridTemplateColumn>
                   
                    <%--<telerik:GridTemplateColumn HeaderText="Cập nhật" HeaderButtonType="TextButton" ItemStyle-HorizontalAlign="Center">
                        <ItemTemplate>
                            <asp:Button ID="btnEdit" CssClass="btnViewDetail" CommandArgument='<%# Eval("ProductID") %>'
                                CommandName="EditItem" runat="server"></asp:Button>
                        </ItemTemplate>
                        <HeaderStyle HorizontalAlign="Center" Width="100px" />
                        <ItemStyle HorizontalAlign="Center" Width="100px"></ItemStyle>
                    </telerik:GridTemplateColumn>--%>
                    <telerik:GridTemplateColumn HeaderText="Xóa" Visible=true HeaderButtonType="TextButton" ItemStyle-HorizontalAlign="Center">
                        <ItemTemplate>
                            <asp:Button ID="btnDelete" CssClass="btnX" CommandArgument='<%# Eval("LocationID") %>'
                                OnClientClick="return ConfirmOnDelete('Bạn chắc chắn muốn xóa?')" CommandName="DeleteItem"
                                runat="server"></asp:Button>
                        </ItemTemplate>
                        <HeaderStyle Width="30px"/>
                            <ItemStyle HorizontalAlign="Center" />
                    </telerik:GridTemplateColumn>
                </Columns>
                </MasterTableView>
            </telerik:radgrid>
        
        </div>
            <!--End Grid data-->
                  </MasterTableView>
                </telerik:RadPageView>
             <!--End Tab thông tin chung -->
            <!--Tim kiem -->
    <telerik:RadPageView ID="RadPageView3" runat="server"  Style="overflow: hidden">
                 <fieldset class="form" id="Fieldset2">
                  <br />
                <div class="form-horizontal wrapper-center clearfix">
                    <!--Block bên trái -->
                 <div class="form-group col-md-6">
                      <!--Dòng -->
                    <div class="form-group">
                        <label class="col-md-3 control-label">
                            Mã cửa hàng</label>
                        <div class="col-md-8">
                            <telerik:RadTextBox ID="txtShopCodeSearch" CssClass="col-imp-4 inputForm" Width="40px" runat="server"  />
                        </div>
                    </div>
                  <!--End Dòng -->
                      <!--Dòng -->
                <div class="form-group">
                    <label class="col-md-3 control-label">Loại cửa hàng</label>
                    <div class="col-md-7">
                        <telerik:RadComboBox ID="cbTypeSearch" runat="server" CssClass="col-imp-5" AllowCustomText="false" EmptyMessage="---Chọn---" filter="Contains" >
                                <Items>
                                    <telerik:RadComboBoxItem Text="---Tất cả---" Value="" />
                                    <telerik:RadComboBoxItem Text="Cửa hàng tổng" Value="W" />
                                    <telerik:RadComboBoxItem Text="Cửa hàng lẻ" Value="S" />
                                </Items>
                            </telerik:RadComboBox>
                        
                     </div>
                </div>
                <!--End Dòng -->
                  <!--Dòng -->
                    <div class="form-group">
                        <label class="col-md-3 control-label">
                            Tên cửa hàng</label>
                        <div class="col-md-8">
                            <telerik:RadTextBox ID="txtShopNameSearch" CssClass="col-imp-8 inputForm" Width="40px" runat="server"  />
                        </div>
                    </div>
                  <!--End Dòng -->
                </div>
                 <!--End Block bên trái -->
                     <!--Block bên phải -->
                <div class="form-group col-md-6">
                    <!--Dòng -->
                    <div class="form-group">
                        <label class="col-md-3 control-label">Từ ngày</label>
                        <div class="col-md-8">
                          <telerik:RadDatePicker ID="rtpFromDateSearch" cssclass="col-imp-8" enabled="true" runat="server" Culture="en-GB"  DateFormat="dd/MM/yyyy" readOnly ="true">
                                <Calendar ID="Calendar3" runat="server" EnableKeyboardNavigation="true" ViewSelectorText="x" Skin="Hay" UseRowHeadersAsSelectors="False" UseColumnHeadersAsSelectors="False">
                                </Calendar>
                                <DateInput  style="width:200px" DisplayDateFormat="dd/MM/yyyy" DateFormat="dd/MM/yyyy"  readOnly ="true"></DateInput>
                            </telerik:RadDatePicker>
                         </div>
                    </div>
                    <!--End Dòng -->
                    <!--Dòng -->
                    <div class="form-group">
                        <label class="col-md-3 control-label">Đến ngày</label>
                        <div class="col-md-8">
                            <telerik:RadDatePicker ID="rtpToDateSearch" cssclass="col-imp-8" enabled="true" runat="server" Culture="en-GB" DateFormat="dd/MM/yyyy" readOnly ="true">
                                <Calendar ID="Calendar4" runat="server" EnableKeyboardNavigation="true" ViewSelectorText="x" Skin="Hay" UseRowHeadersAsSelectors="False" UseColumnHeadersAsSelectors="False">
                                </Calendar>
                                <DateInput  style="width:200px" DisplayDateFormat="dd/MM/yyyy" DateFormat="dd/MM/yyyy"  readOnly ="true"></DateInput>
                            </telerik:RadDatePicker>
                         </div>
                    </div>
                    <!--End Dòng -->
                </div>
                 <!--End Block bên phải -->
                </div>
                <!--Button Tim Kiem-->
                 <div class="set-btns text-center">
                     <asp:Button ID="btnSearch" CssClass="btn btn-sm btn-primary" runat="server" OnClick="btnSearch_Click" Text="Tìm kiếm"  />
                </div> 
                <!--End Button Tim Kiem--> 
                </fieldset>
        <br />
        <!--Grid data-->
           <div class="row">
                <div style="float: left;font-weight:bold" runat="server" id="div_TotalRows" >&nbsp;Kết quả tìm kiếm: 0</div>
                <div style="float: right;"><asp:Button ID="btnRefresh" CssClass="btnRefresh" ToolTip="Refresh" runat="server" OnClick="btnRefresh_Click" Text="Refresh"  /></div> 
            <telerik:radgrid id="gvData" runat="server" cellspacing="0" cssclass=" table table-bordered"
                gridlines="None" autogeneratecolumns="False" headerstyle-horizontalalign="Center" PageSize="10" AllowCustomPaging="true"
                allowmultirowselection="True" headerstyle-borderstyle="None" Height="250" ShowHeader="true" OnNeedDataSource="gvData_NeedDataSource"  OnItemCommand="gvData_ItemCommand">
                
                <MasterTableView ShowHeader="true" NoMasterRecordsText="Không có dữ liệu." ShowGroupFooter="true" AllowPaging="True" PageSize="10" EditMode="InPlace">
                <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column"></RowIndicatorColumn>
                 <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column"></ExpandCollapseColumn>
                <Columns>
                    <telerik:GridTemplateColumn HeaderText="STT" HeaderButtonType="TextButton" ItemStyle-HorizontalAlign="Center">
                        <ItemTemplate>
                            <%# Eval("RowID") %></ItemTemplate>
                        <HeaderStyle Width="30px" />
                        <ItemStyle HorizontalAlign="Center" />
                    </telerik:GridTemplateColumn>
                    <telerik:GridBoundColumn  DataField="ShopCode" UniqueName="ShopCode"  ReadOnly="true" HeaderText="Mã cửa hàng">
                        <HeaderStyle HorizontalAlign="Center"  Width="100px" />
                        <ItemStyle HorizontalAlign="Center" />
                    </telerik:GridBoundColumn>
                     <telerik:GridBoundColumn  DataField="ShopName" UniqueName="ShopName"  ReadOnly="true" HeaderText="Tên cửa hàng">
                        <HeaderStyle HorizontalAlign="Center"  Width="100px" />
                        <ItemStyle HorizontalAlign="Left" />
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn  DataField="ShopTypeName" UniqueName="ShopTypeName"  ReadOnly="true" HeaderText="Loại cửa hàng">
                        <HeaderStyle HorizontalAlign="Center"  Width="100px" />
                        <ItemStyle HorizontalAlign="Left" />
                    </telerik:GridBoundColumn>
                     <telerik:GridBoundColumn  DataField="Address" UniqueName="Address"  ReadOnly="true" HeaderText="Địa chỉ">
                        <HeaderStyle HorizontalAlign="Center" Width="100px" />
                        <ItemStyle HorizontalAlign="Left" /></telerik:GridBoundColumn>
                    <telerik:GridBoundColumn  DataField="PhoneNumber" UniqueName="PhoneNumber"  ReadOnly="true" HeaderText="Số điện thoại">
                        <HeaderStyle HorizontalAlign="Center" Width="100px" />
                        <ItemStyle HorizontalAlign="Center" /></telerik:GridBoundColumn>
                    <telerik:GridTemplateColumn HeaderText="Chi tiết" HeaderButtonType="TextButton" ItemStyle-HorizontalAlign="Center">
                        <ItemTemplate>
                            <asp:Button ID="Button1" CssClass="btnViewDetail" CommandArgument='<%# Eval("ShopID") %>'
                                CommandName="EditItem" runat="server"></asp:Button>
                        </ItemTemplate>
                        <HeaderStyle HorizontalAlign="Center" Width="50px" />
                        <ItemStyle HorizontalAlign="Center" ></ItemStyle>
                    </telerik:GridTemplateColumn>
                    <%--<telerik:GridTemplateColumn HeaderText="Xóa" Visible=true HeaderButtonType="TextButton" ItemStyle-HorizontalAlign="Center">
                        <ItemTemplate>
                            <asp:Button ID="Button2" CssClass="btnX" CommandArgument='<%# Eval("TransferWarehouseID") %>'
                                OnClientClick="return ConfirmOnDelete('Bạn chắc chắn muốn xóa không?')" CommandName="DeleteItem"
                                runat="server"></asp:Button>
                        </ItemTemplate>
                        <HeaderStyle Width="30px"/>
                            <ItemStyle HorizontalAlign="Center" />
                    </telerik:GridTemplateColumn>--%>
               </Columns>
                </MasterTableView>
            </telerik:radgrid>
        </div>
            <!--End Grid data--> 
    </telerik:RadPageView>
    <!--End Tab Tim kiem -->
     </telerik:RadMultiPage>
<div style="clear:both"></div>
</ContentTemplate>
</asp:UpdatePanel>

<div class="progressbar">
    <asp:UpdateProgress ID="up" runat="server" AssociatedUpdatePanelID="UpdatePanel1">
        <ProgressTemplate>
            <div class="bg">
                <div class="progress progress-striped active">
                    <div class="progress-bar" role="progressbar" aria-valuenow="45" aria-valuemin="0"
                        aria-valuemax="100" style="width: 100%">
                        <span class="sr-only">100% Complete</span>
                    </div>
                </div>
            </div>
        </ProgressTemplate>
    </asp:UpdateProgress>
</div>
